#include <cstdio>

long long f[ 46343 ];

int main( )
{
    int t;
    long long n, l, r, mid, i, a, b;
    for ( i = 1; i <= 46342; i++ )
        f[ i ] = f[ i - 1 ] + ( i * i - ( i - 1 ) * ( i - 1 ) - 1 ) * ( i - 1 ) + i;
    scanf("%d", &t);
    while ( t-- )
    {
        scanf("%I64d", &n);
        l = 1; r = 46342;
        while ( l < r )
        {
            mid = ( l + r ) / 2;
            if ( mid * mid - mid < n )
                l = mid + 1;
            else
                r = mid;
        }
        a = ( l - 1 ) * ( l - 1 ) + n - ( ( l - 1 ) * ( l - 1 ) - ( l - 1 ) );
        l = 1; r = 46342;
        while ( l < r )
        {
            mid = ( l + r ) / 2;
            if ( mid * mid < a )
                l = mid + 1;
            else
                r = mid;
        }
        if ( l * l == a )
            b = f[ l ];
        else
        {
            l--;
            b = f[ l ] + ( a - l * l ) * l;
        }
        printf("%I64d %I64d\n", a, b);
    }
    return 0;
}
